extern "C"
{
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <linux/can.h>
#include <linux/can/raw.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <fcntl.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <string.h>
#include <time.h>
}
#include <string>

typedef struct imu_data_s
{
	double accel_x;
	double accel_y;
	double accel_z;
	double ang_x;
	double ang_y;
	double ang_z;
	double quad_x;
	double quad_y;
	double quad_z;
	double quad_w;
} imu_data_t;

typedef enum
{
	accel = 0x180,
	angula = 0x280,
	euler = 0x380,
	quad = 0x480,
	pascal = 0x680
} imu_frame_id;

class Imu
{
	public:
	Imu(int addr = 0);
	~Imu();
	int open(std::string ifname = "can0");
	int recv(imu_data_t &data);
	bool is_open();
	private:
	int _sock = -1;
	int _addr = 0;  // can frame id offset
};






